inspector: Show object title on selector tab
authorMatthias Clasen <mclasen@redhat.com>
Sat, 22 Nov 2014 21:21:17 +0000 (16:21 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Sun, 23 Nov 2014 02:38:47 +0000 (21:38 -0500)
gtk/inspector/selector.c
gtk/inspector/selector.ui

index cfaed2feab0f46dcce7d7a595d9da6e3b07ff778..ce8c763176df9a773748d5e5b4fe1d0416a6988f 100644 (file)
@@ -24,6 +24,7 @@
 #include "gtktreestore.h"
 #include "gtktreeview.h"
 #include "gtkwidgetpath.h"
+#include "gtklabel.h"
 
 
 enum
@@ -35,6 +36,7 @@ struct _GtkInspectorSelectorPrivate
 {
   GtkTreeStore *model;
   GtkTreeView *tree;
+  GtkWidget *object_title;
 };
 
 G_DEFINE_TYPE_WITH_PRIVATE (GtkInspectorSelector, gtk_inspector_selector, GTK_TYPE_BOX)
@@ -54,6 +56,7 @@ gtk_inspector_selector_class_init (GtkInspectorSelectorClass *klass)
   gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/inspector/selector.ui");
   gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorSelector, model);
   gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorSelector, tree);
+  gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorSelector, object_title);
 }
 
 void
@@ -64,6 +67,7 @@ gtk_inspector_selector_set_object (GtkInspectorSelector *oh,
   gint i;
   GtkWidget *widget;
   gchar *path, **words;
+  const gchar *title;
 
   gtk_tree_store_clear (oh->priv->model);
 
@@ -73,6 +77,9 @@ gtk_inspector_selector_set_object (GtkInspectorSelector *oh,
       return;
     }
 
+  title = (const gchar *)g_object_get_data (object, "gtk-inspector-object-title");
+  gtk_label_set_label (GTK_LABEL (oh->priv->object_title), title);
+
   widget = GTK_WIDGET (object);
 
   path = gtk_widget_path_to_string (gtk_widget_get_path (widget));
index 5f6d6ae2e4def832fc37cfc80552b76664c724c3..19f89280b5d261be74cf860670ac8a614c609b05 100644 (file)
@@ -6,7 +6,16 @@
     </columns>
   </object>
   <template class="GtkInspectorSelector" parent="GtkBox">
-    <property name="orientation">horizontal</property>
+    <property name="orientation">vertical</property>
+    <child>
+      <object class="GtkLabel" id="object_title">
+        <property name="visible">True</property>
+        <property name="halign">fill</property>
+        <property name="valign">center</property>
+        <property name="margin-top">12</property>
+        <property name="margin-bottom">12</property>
+      </object>
+    </child>
     <child>
       <object class="GtkScrolledWindow">
         <property name="visible">True</property>